﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.Linq;
using System.ServiceProcess;
using System.Text;
using System.Timers;
using System.IO;
using Task.Log;
using Task.Quartz.Example;
using Task.Util;

namespace Task.Services
{
    partial class ServiceHE : ServiceBase
    {
        public ServiceHE()
        {
            InitializeComponent();
            this.CanPauseAndContinue = true;
            this.CanShutdown = true;
            this.CanStop = true;
            this.AutoLog = true;
        }

        protected override void OnStart(string[] args)
        {
            try
            {
                MyJobTests.Instance.OnStartServer();
            }
            catch (Exception ex)
            {
                LogHelper.Fatal("OnStart:" + ex, System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
            }
        }
        protected override void OnStop()
        {
            try
            {
                MyJobTests.Instance.OnStopService();
            }
            catch (Exception ex)
            {
                LogHelper.Fatal("OnStop:" + ex, System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
            }
        }

        protected override void OnPause()
        {
            try
            {
                MyJobTests.Instance.OnPauseService();
            }
            catch (Exception ex)
            {
                LogHelper.Fatal("OnPause:" + ex, System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
            }
        }

        protected override void OnContinue()
        {
            try
            {
                MyJobTests.Instance.OnContinueService();
            }
            catch (Exception ex)
            {
                LogHelper.Fatal("OnContinue:" + ex, System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
            }
        }

        protected override void OnShutdown()
        {
            try
            {
                MyJobTests.Instance.OnStopService();
            }
            catch (Exception ex)
            {
                LogHelper.Fatal("OnShutdown:" + ex, System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
            }
        }

    }
}
